class UserInfo {
  String id;
  String realname;
  String mobile;
  Gender gender;
  String identityCard;
  String headUrl;
  String jobNumber;
  String craftName;
  String deptId;
  String deptName;
  String politicCountenance;
  String duty;
  String professionalTitle;
  String education;
  String nativePlace;
  DateTime joinThePartyTime;
  DateTime birthday;

  UserInfo({
    this.id,
    this.realname,
    this.mobile,
    this.gender,
    this.identityCard,
    this.headUrl,
    this.jobNumber,
    this.craftName,
    this.deptId,
    this.deptName,
    this.politicCountenance,
    this.duty,
    this.professionalTitle,
    this.education,
    this.nativePlace,
    this.joinThePartyTime,
    this.birthday,
  });

  static UserInfo fromJson(Map<String, dynamic> json) {
    return UserInfo(
      id: json['id'],
      realname: json['realname'],
      mobile: json['mobile'],
      gender: Gender.values[json['gender']],
      identityCard: json['identityCard'],
      headUrl: json['headUrl'],
      jobNumber: json['jobNumber'],
      craftName: json['craftName'],
      deptId: json['deptId'],
      deptName: json['deptName'],
      politicCountenance: json['politicCountenance'],
      duty: json['duty'],
      professionalTitle: json['professionalTitle'],
      education: json['edication'],
      nativePlace: json['nativePlace'],
      joinThePartyTime: json['joinThePartyTime'] == null ? null : DateTime.parse(json['joinThePartyTime']),
      birthday: json['birthday'] == null ? null : DateTime.parse(json['birthday']),
    );
  }
}

enum Gender {
  None,
  Boy,
  Girl,
}
